﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace kim.Web.dc0802.ListType
{
    public partial class List : kim.UI.ManagePage
    {
        public StringBuilder StrList = new StringBuilder();
        protected void Page_Load(object sender, EventArgs e)
        {
            strListTyep();
        }
        private void strListTyep()
        {
            
            List<Model.ListTypea> moTopList = new BLL.ListTypea().GetModelList("IsParent=0");
            if (moTopList.Count > 0)
            {
               
                foreach (Model.ListTypea topMo in moTopList)
                {
                    StrList.AppendFormat("<tr><td align=\"center\">{0}</td>", topMo.ListID);
                    StrList.AppendFormat("<td align=\"center\">{0}</td>", topMo.NeName);
                    StrList.AppendFormat("<td align=\"center\" style=\"color:Red;\">{0}</td>", topMo.ListUrl);
                     StrList.Append("<td align=\"center\">");
                     StrList.AppendFormat("<span><a href=\"AddorEdit.aspx?id={0}&type=Edit&IsParent={1}\">修改</a></span>", topMo.ListID, topMo.IsParent);
                     StrList.AppendFormat("<span><a href=\"AddorEdit.aspx?id={0}&type=Delete&IsParent={1}\" onclick=\"return confirm( '确定要删除吗？ ')\">删除</a></span>", topMo.ListID, topMo.IsParent);
                     StrList.Append("</tr>");
                     List<Model.ListTypea> moList = new BLL.ListTypea().GetModelList("IsParent=" + topMo.ListID);
                    if (moList.Count > 0)
                    {
                        foreach (Model.ListTypea mo in moList)
                        {
                            StrList.AppendFormat("<tr><td align=\"center\">{0}</td>", mo.ListID);
                            StrList.AppendFormat("<td align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {0}</td>", mo.NeName);
                            StrList.AppendFormat("<td align=\"center\">{0}</td>", mo.ListUrl);
                            StrList.Append("<td align=\"center\">");
                            StrList.AppendFormat("<span><a href=\"AddorEdit.aspx?id={0}&type=Edit&IsParent={1}\">修改</a></span>", mo.ListID, mo.IsParent);
                            StrList.AppendFormat("<span><a href=\"AddorEdit.aspx?id={0}&type=Delete&IsParent={1}\" onclick=\"return confirm( '确定要删除吗？ ')\">删除</a></span>", mo.ListID, mo.IsParent);
                            StrList.Append("</tr>");
                        }
                    }
                }
            }
        }
    }
}